import { Actor } from "./Actor";

export class Player {
  account: string;
  curActorId: number;
  actors: Actor[];
  constructor(account: string, actors: Actor[]) {
    this.account = account;
    this.actors = actors;
  }

  getActor(actorId: number = this.curActorId) {
    const actor = this.actors.find((e) => e.id === actorId);

    if (actor) {
      return actor;
    } else {
      throw new Error("no actor");
    }
  }
}
